package com.example.traning.web.controller;

import com.example.traning.web.common.R;
import com.example.traning.web.controller.vo.UserVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * RestController = ResponseBody + Controller
 *
 * @author lei yu
 * @since 2025/04/27
 */
@RequestMapping("basic")
@RestController
public class BasicController {

    /**
     * <a href="http://localhost:8080/basic/test">...</a>
     */
    @GetMapping("test")
    public String test() {
        return "test ret";
    }

    /**
     * <a href="http://localhost:8080/basic/ret">...</a>
     * {"code":0,"msg":"成功","data":{"id":"1","name":"张三"}}
     */
    @GetMapping("ret")
    public R retResult() {
        UserVO vo = null;
        vo = new UserVO().setId("1").setName("张三");
        return R.ok(vo);
    }


}
